<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator"%>
<!DOCTYPE html>
<html lang="en">
	<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title><decorator:title></decorator:title></title>
		<meta name="renderer" content="webkit">
  		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/style.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/bootstrap.css">
		<decorator:head />
	</head>

	<body>
		<!-- start header -->
		<header id="back-top">
			<div class="top center">
				<div class="left fl">
					<ul>
						<li class="site-demo-button" id="pingtaijianjie" style="margin-bottom: 0;">
							<a data-method="notice" class="layui-btn" href="javascript:void(0)" style="background:none;">平台简介</a>
						</li>
						<li>|</li>
						<li><a href="javascript:void(0)" id="jianyifankui">建议反馈</a></li>
						<!-- 建议反馈Modal -->
						<div class="modal fade" id="jianyifankuiModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
						  <div class="modal-dialog" role="document">
						    <div class="modal-content">
						      <div class="modal-header">
						        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						        <h4 class="modal-title" id="myModalLabel">建议反馈：</h4>
						      </div>
						      <div class="modal-body">
						      	<textarea id="jianyifankuicontent"></textarea>
						      	<p id="jianyifankuinumber">0</p>
						      </div>
						      <div class="modal-footer">
						        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						        <button type="button" class="btn btn-primary" id="jianyifankuibutton">提交</button>
						      </div>
						    </div>
						  </div>
						</div><!-- end建议反馈Modal -->
						<li>|</li>
						<li>
							<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=879532354&site=qq&menu=yes">
								联系客服
							</a>
						</li>
						<li style="padding-left:60px;">校园定位：</li>
						<li>
							<form class="layui-form dingwei province">
						      <select name="province" id="province" lay-filter="province">
						        <option value="0">全部省份</option>
					        	<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
					        		<c:forEach items="${provinceList}" var="provinceList">
					        			<c:if test="${provinceList.name == provinceName}">
					        				<option value="${provinceList.id}" selected>${provinceList.name}</option>
					        			</c:if>
					        			<c:if test="${provinceList.name != provinceName}">
					        				<option value="${provinceList.id}">${provinceList.name}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
					        	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
					        		<c:forEach items="${provinceList}" var="provinceList">
					        			<c:if test="${cshtUserVo.province == provinceList.name || provinceName == provinceList.name}">
					        				<option value="${provinceList.id}" selected>${provinceList.name}</option>
					        			</c:if>
						        		<c:if test="${cshtUserVo.province != provinceList.name}">
					        				<option value="${provinceList.id}">${provinceList.name}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
						      </select>
							</form>
						</li>
						<li>
							<form class="layui-form dingwei city">
						      <select name="city" id="city" lay-filter="city">
						        <option value="全部城市">全部城市</option>
						        <c:if test="${cshtUserVo == null || cshtUserVo == ''}">
					        		<c:forEach items="${cityList}" var="cityList">
						        		<c:if test="${cityName == cityList}">
						        			<option value="${cityList}" selected>${cityList}</option>
					        			</c:if>
					        			<c:if test="${cityName != cityList}">
					        				<option value="${cityList}">${cityList}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
					        	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
					        		<c:forEach items="${cityList}" var="cityList">
					        			<c:if test="${cshtUserVo.city == cityList || cityName == cityList}">
					        				<option value="${cityList}" selected>${cityList}</option>
					        			</c:if>
						        		<c:if test="${cshtUserVo.city != cityList}">
					        				<option value="${cityList}">${cityList}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
						      </select>
							</form>
						</li>
						<li>
							<form class="layui-form dingwei">
						      <select name="school" id="school" lay-filter="school">
						        <option value="全部学校">全部学校</option>
						        <c:if test="${cshtUserVo == null || cshtUserVo == ''}">
					        		<c:forEach items="${schoolList}" var="schoolList">
						        		<c:if test="${schoolName == schoolList.name}">
						        			<option value="${schoolList.name}" selected>${schoolList.name}</option>
					        			</c:if>
					        			<c:if test="${schoolName != schoolList.name}">
					        				<option value="${schoolList.name}">${schoolList.name}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
					        	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
					        		<c:forEach items="${schoolList}" var="schoolList">
					        			<c:if test="${cshtUserVo.school == schoolList.name || schoolName == schoolList.name}">
					        				<option value="${schoolList.name}" selected>${schoolList.name}</option>
					        			</c:if>
						        		<c:if test="${cshtUserVo.school != schoolList.name}">
					        				<option value="${schoolList.name}">${schoolList.name}</option>
					        			</c:if>
						        	</c:forEach>
					        	</c:if>
						      </select>
							</form>
						</li>
					</ul>
					<div class="clear"></div>
				</div>
				<div class="right fr">
					<div class="gouwuche fr"><a href="${pageContext.request.contextPath}/toMy/sell">个人中心</a></div>
					<div class="fr">
						<ul>
							<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
								<li><a href="${pageContext.request.contextPath}/login">登录</a></li>
							</c:if>
							<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
								<li class="user-header-li">
									<a href="${pageContext.request.contextPath}/toMy/my" class="user-header-aaa">
										<img class="user-header-head" src="/csht_file/user_header/${cshtUserVo.userHeadPath}">
										<span class="user-header-username">${cshtUserVo.userUsername}</span>
									</a>
									<a href="javascript:void(0)" id="logout" class="user-header-a">退出</a>
								</li>
							</c:if>
							<li>|</li>
							<li><a href="${pageContext.request.contextPath}/register">注册</a></li>
							<li>|</li>
							<li>
								<a href="${pageContext.request.contextPath}/toMy/notice">
									消息通知
									<c:if test="${cshtUserVo != null || cshtUserVo == ''}">
										<span class="badge">${cshtUserVo.userNoticeNumber}</span>
									</c:if>
								</a>
							</li>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</header>
		<!--end header -->
		
		<!-- start banner_x -->
		<div class="banner_x center">
			<a href="${pageContext.request.contextPath}/index"><div class="logo fl"></div></a>
			<a href="javascript:void(0)"><div class="ad_top fl"></div></a>
			<div class="nav fl">
				<ul class="nav-ul">
					<li class="nav-li"><a href="${pageContext.request.contextPath}/index" class="nav_a">首页</a></li>
					<li class="nav-li"><a href="${pageContext.request.contextPath}/goods/oneMenuGoods/${cshtOneMenuVoList[0].oneMenuId}" class="nav_a">${cshtOneMenuVoList[0].oneMenuName}</a></li>
					<li class="nav-li"><a href="${pageContext.request.contextPath}/goods/oneMenuGoods/${cshtOneMenuVoList[1].oneMenuId}" class="nav_a">${cshtOneMenuVoList[1].oneMenuName}</a></li>
					<li class="nav-li"><a href="${pageContext.request.contextPath}/goods/oneMenuGoods/${cshtOneMenuVoList[2].oneMenuId}" class="nav_a">${cshtOneMenuVoList[2].oneMenuName}</a></li>
					<li class="nav-li moremenu">
						<a href="javascript:void(0)" class="nav_a">
							更多菜单
							<span class="glyphicon glyphicon-triangle-bottom"></span>
						</a>
						<div class="glmenunav">
							<ul>
								<c:forEach items="${cshtOneMenuVoList}" var="cshtOneMenuVoList">
									<li class="onemenuli">
										<a href="${pageContext.request.contextPath}/goods/oneMenuGoods/${cshtOneMenuVoList.oneMenuId}" target="_blank">${cshtOneMenuVoList.oneMenuName}</a>
										<div class="twomenudiv">
											<ul>
												<c:forEach items="${cshtOneMenuVoList.cshtTwoMenuVoList}" var="cshtTwoMenuVoList">
													<li class="twomenuli">
														<a href="${pageContext.request.contextPath}/goods/twoMenuGoods/${cshtTwoMenuVoList.twoMenuId}" target="_blank">${cshtTwoMenuVoList.twoMenuName}</a>
														<div class="threemenudiv">
															<ul>
																<c:forEach items="${cshtTwoMenuVoList.cshtThreeMenuList}" var="cshtThreeMenuList">
																	<li class="threemenuli"><a href="${pageContext.request.contextPath}/goods/threeMenuGoods/${cshtThreeMenuList.threeMenuId}" target="_blank">${cshtThreeMenuList.threeMenuName}</a></li>
																</c:forEach>
															</ul>
														</div>
													</li>
												</c:forEach>
											</ul>
										</div>
									</li>
								</c:forEach>
							</ul>
						</div>
					</li>
					<li class="nav-li">|</li>
					<li class="nav-li"><a href="${pageContext.request.contextPath}/goods/releaseGoods" class="nav_a">发布商品</a></li>
					<li class="nav-li">
						<a class="nav_a myshangpin">我的商品 <span class="glyphicon glyphicon-triangle-bottom"></span></a>
						<div class="list-group myshangpin-xia">
						  <a href="${pageContext.request.contextPath}/toMy/sell" class="list-group-item">
						  	出售中：
						  	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
								<span>${cshtUserVo.userGoodsNumber}</span>
							</c:if>
						  	<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
								<span>0</span>
							</c:if>
						  </a>
						  <a href="${pageContext.request.contextPath}/toMy/trading" class="list-group-item">
						  	交易中：
						  	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
								<span>${cshtUserVo.userTradingNumber}</span>
							</c:if>
						  	<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
								<span>0</span>
							</c:if>
						  </a>
						  <a href="${pageContext.request.contextPath}/toMy/tradingSuccess" class="list-group-item">
						  	已出售：
						  	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
								<span>${cshtUserVo.userTradingSuccessNumber}</span>
							</c:if>
						  	<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
								<span>0</span>
							</c:if>
						  </a>
						  <a href="${pageContext.request.contextPath}/toMy/shelves" class="list-group-item">
						  	已下架：
						  	<c:if test="${cshtUserVo != null && cshtUserVo != ''}">
								<span>${cshtUserVo.userShelvesNumber}</span>
							</c:if>
						  	<c:if test="${cshtUserVo == null || cshtUserVo == ''}">
								<span>0</span>
							</c:if>
						  </a>
						</div>
					</li>
				</ul>
			</div>
			<div class="search fr">
				<div class="text fl">
					<input type="text" class="shuru" id="goodsSouSuoVal" placeholder="请输入搜索关键词">
				</div>
				<div class="submit fl">
					<input type="button" id="goodsSouSuobtn" class="sousuo" value="搜索"/>
				</div>
				<div class="clear"></div>
			</div>
		</div>
		<!-- end banner_x -->
		
		
		
		<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.all.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/bootstrap.js"></script>
		<!-- 跳跳字体动画 -->
		<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/easying.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.beattext.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				
				//搜索
				$("#goodsSouSuobtn").on("click", function(){
					var goodsSouSuoVal = $("#goodsSouSuoVal").val();
					if(goodsSouSuoVal == ""){
						layer.msg("请输入搜索关键词");
					}else{
						window.open("${pageContext.request.contextPath}/goods/sousuo/" + goodsSouSuoVal);
					}
				});
				
				
				//滑动更多菜单显示一级菜单
				$(".moremenu a").mouseover(function(){
					$(".twomenudiv").hide();
					$(".moremenu .glmenunav").show();
				});
				//滑动一级菜单显示二级菜单
				$(".moremenu .glmenunav .onemenuli").mouseover(function(){
					$(".twomenudiv").hide();
					$(this).children(".twomenudiv").show();
				});
				//滑动一级菜单隐藏三级菜单
				$(".moremenu .glmenunav .onemenuli a").mouseover(function(){
					$(".threemenudiv").hide();
				});
				//滑动二级菜单显示三级菜单
				$(".moremenu .glmenunav .onemenuli .twomenuli").mouseover(function(){
					$(".threemenudiv").hide();
					$(this).children(".threemenudiv").show();
				});
				//鼠标滑出去菜单区域
				$(".moremenu").mouseout(function(){
					$(this).children(".glmenunav").hide();
				});
				
				//返回顶部按钮
				if (document.documentElement.scrollTop == 0){
					$(".back-to-top").fadeOut();
		        }else if (document.body == 0){
		        	$(".back-to-top").fadeOut();
		        }else{
		        	$(".back-to-top").fadeIn();
		        }
				
				$(document).scroll(function(){
					if (document.documentElement.scrollTop == 0){
						$(".back-to-top").fadeOut();
			        }else if (document.body == 0){
			        	$(".back-to-top").fadeOut();
			        }else{
			        	$(".back-to-top").fadeIn();
			        }
				});
				
				//鼠标移到我的商品时切换图标
				$(".myshangpin").mouseover(function(){
					$(".myshangpin span").attr("class", "glyphicon glyphicon-triangle-top");
					$(".myshangpin").css("color", "#ff6700");
				});
				//鼠标移开我的商品时切换图标
				$(".myshangpin").mouseout(function(){
					$(".myshangpin span").attr("class", "glyphicon glyphicon-triangle-bottom");
					$(".myshangpin").css("color", "#000");
				});
				$(".myshangpin-xia").mouseover(function(){
					$(".myshangpin span").attr("class", "glyphicon glyphicon-triangle-top");
					$(".myshangpin").css("color", "#ff6700");
				});
				$(".myshangpin-xia").mouseout(function(){
					$(".myshangpin span").attr("class", "glyphicon glyphicon-triangle-bottom");
					$(".myshangpin").css("color", "#000");
				});
		    	
		    	//建议反馈
		    	$("#jianyifankui").click(function(){
		    		if(null == "${cshtUserVo}" || "" == "${cshtUserVo}"){ //没登录
		    			layer.msg('请先登录');
		    		}else{
		    			$("#jianyifankuiModal").modal("show");
		    		}
		    	});
		    	
		    	//建议反馈内容发生改变,计算内容长度
		    	$("#jianyifankuicontent").on("input", function(){
		    		$("#jianyifankuinumber").text($(this).val().length);
		    	});
		    	
		    	//点击建议反馈的提交按钮
		    	$("#jianyifankuibutton").on("click", function(){
		    		var jianyifankuicontent = $("#jianyifankuicontent").val();
		    		if(jianyifankuicontent.length < 10){
		    			layer.msg('不能少于10个字');
		    		}else{
		    			var jianyifankuicontent = $("#jianyifankuicontent").val();
		    			$.ajax({
		    				url: "${pageContext.request.contextPath}/insertAdvice",
		    				type: "post",
		    				dataType: "json",
		    				data: {
		    					"adviceContent": jianyifankuicontent
		    				},
		    				success: function(data){
		    					if(true == data.message){
		    						layer.msg('反馈成功');
		    					}else{
		    						layer.msg('反馈失败');
		    					}
		    				}
		    			});
		    			$("#jianyifankuiModal").modal("hide");
		    		}
		    	});
		    	
		    	//省份发生改变(layui的下拉框监听)
		    	layui.form.on("select(province)", function(data){
		    		var provinceId = data.value; //省id
		    		var provinceName = $("#province option[value = " + provinceId + "]").text(); //省名称
		    		location.href = "${pageContext.request.contextPath}/positionToProvince?provinceId=" + provinceId + "&provinceName=" + provinceName;
		    	});
		    	
		    	//城市发生改变(layui的下拉框监听)
		    	layui.form.on("select(city)", function(data){
		    		var cityName = data.value; //省名称
		    		location.href = "${pageContext.request.contextPath}/positionToCity?cityName=" + cityName;
		    	});
		    	
		    	//城市发生改变(layui的下拉框监听)
		    	layui.form.on("select(school)", function(data){
		    		var schoolName = data.value; //省名称
		    		location.href = "${pageContext.request.contextPath}/positionToSchool?schoolName=" + schoolName;
		    	});
		    	
		    	//平台简介弹出框
		    	layui.use('layer', function(){ //独立版的layer无需执行这一句
					  var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
					  //触发事件
					  var active = {
					    notice: function(){
					      //示范一个公告层
					      layer.open({
					        type: 1
					        ,title: '平台简介' //不显示标题栏
					        ,closeBtn: false
					        ,area: '600px;'
					        ,shade: 0.8
					        ,id: 'pingtaijianjie-1' //设定一个id，防止重复弹出
					        ,btn: ['关闭']
					        ,btnAlign: 'c'
					        ,moveType: 1 //拖拽模式，0或者1
					        ,content: '<div style="padding: 20px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' + 
					        		'平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介' + 
					        		'台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介' + 
					        		'平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介' + 
					        		'简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介' + 
					        		'简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介' + 
					        		'简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介平台简介</div>'
					        
					      });
					    }
					  };
					  
					  $('#pingtaijianjie .layui-btn').on('click', function(){
					    var othis = $(this), method = othis.data('method');
					    active[method] ? active[method].call(this, othis) : '';
					  });
					  
					});
		    	
		    	//点击退出
		    	$("#logout").on("click", function(){
		    		layer.open({
						  content: '确定退出登录？',
						  title: '提示:',
						  btn: ['确定', '取消'],
						  icon: 1,
						  anim: 6,
						  yes: function(index, layero){
							  layer.close(index); //如果设定了yes回调，需进行手工关闭
							  location.href = "${pageContext.request.contextPath}/Logout";
							  }
					});
		    	})
			})
		</script>
		
		<decorator:body></decorator:body>
	
		<footer class="mt20 center">			
			<div>校园闲置商品交易平台</div>
			<div>16软件2班：陈恢严、王燕铓、詹柱师</div>
		</footer>
		
		<!-- 返回顶部按钮 -->
		<div class="back-to-top" title="返回顶部"><a href="#back-top"><i class="glyphicon glyphicon-arrow-up"></i></a></div>
	
	</body>
	
</html>




